package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.TreeEntity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 商品分类
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-12
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_shop_classify")
@ApiModel(value = "ShopClassify", description = "商品分类")
@AllArgsConstructor
public class ShopClassify extends TreeEntity<ShopClassify, Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 分类名称
     */
    @ApiModelProperty(value = "分类名称")
    @NotEmpty(message = "分类名称不能为空")
    @Length(max = 50, message = "分类名称长度不能超过50")
    @TableField(value = "classify_name", condition = LIKE)
    @Excel(name = "分类名称")
    private String classifyName;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField("sort_order")
    @Excel(name = "排序")
    private Integer sortOrder;

    @ApiModelProperty(value = "")
    @TableField("create_date")
    @Excel(name = "", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "img_url", condition = LIKE)
    @Excel(name = "")
    private String imgUrl;

    /**
     * 状态：0-启用 1-禁用 2-删除
     */
    @ApiModelProperty(value = "状态：0-启用 1-禁用 2-删除")
    @NotNull(message = "状态：0-启用 1-禁用 2-删除不能为空")
    @TableField("status")
    @Excel(name = "状态：0-启用 1-禁用 2-删除")
    private Integer status;

    /**
     * 审核状态：0-待审核 1-审核通过 2-审核不通过
     */
    @ApiModelProperty(value = "审核状态：0-待审核 1-审核通过 2-审核不通过")
    @NotNull(message = "审核状态：0-待审核 1-审核通过 2-审核不通过不能为空")
    @TableField("verify_status")
    @Excel(name = "审核状态：0-待审核 1-审核通过 2-审核不通过")
    private Integer verifyStatus;

    @ApiModelProperty(value = "")
    @Length(max = 255, message = "长度不能超过255")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "")
    private String url;
    /*@TableField(exist = false)
    private List<ShopClassifySpec> shopClassifySpecList ;*/
    @Builder
    public ShopClassify(Long id, Long parentId, 
                    String classifyName, Integer sortOrder, LocalDateTime createDate, String imgUrl, Integer status, Integer verifyStatus, String url) {
        this.id = id;
        this.parentId = parentId;
        this.classifyName = classifyName;
        this.sortOrder = sortOrder;
        this.createDate = createDate;
        this.imgUrl = imgUrl;
        this.status = status;
        this.verifyStatus = verifyStatus;
        this.url = url;
    }

}
